<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="dominio.SolicitudArticulo"%>
<%@page import="dominio.ArticuloItem"%>
<%@page import="java.util.*"%>
<%@page import="java.lang.*"%>
<!DOCTYPE html>
<html>
<head>
	<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" /> -->
<!-- 	<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> -->
<!-- 	<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script> -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Entregar Articulos</title>
</head>

<body>
	<%
		SolicitudArticulo solicitudArticulo = (SolicitudArticulo) request.getAttribute("data");
			List<ArticuloItem> articuloItems = solicitudArticulo.getArticulosItems();
	%>

	<h1>Articulos a Entregar</h1> 
	<h2>Modulo <%=solicitudArticulo.getIdModulo() %></h2>
	<h2>ID <%=solicitudArticulo.getIdSolicitud() %></h2>
	
	<%
		for(Iterator<ArticuloItem> itr = articuloItems.iterator(); itr.hasNext(); ) {
			ArticuloItem articuloItem = itr.next();
	%>
	
	<form action="entregarArticulos" method="post" >
	<input type="hidden" id="idModulo" name="idModulo" value=<%=solicitudArticulo.getIdModulo()%>>
	<input type="hidden" id="idSolicitud" name="idSolicitud" value=<%=solicitudArticulo.getIdSolicitud()%>>
	<input type="hidden" id="id" name="id" value=<%=articuloItem.getCodigo()%>>
	<fieldset>
	
	<div  id="buttons-1" data-type="vertical">
		<input type="text" value="Codigo de Articulo"/>
		<input type="text" value="<%=articuloItem.getCodigo()%>"/>
		<label>Cantidad Solicitada</label>
		<label><%=articuloItem.getCantidadSolicitada()%> </label>
		<label>Cantidad Entregada</label>
		<label><%=articuloItem.getCantidadEntregada()%> </label>
		<%if (!articuloItem.entregado()) { %>
			<label>Cantidad a entregar</label>
			<input type="text"   id="cantidadAEntregar" name="cantidadAEntregar"/>
			<input type="submit"  value="Entregar"/>
		<%} %>
		</div>
	</fieldset>			
	</form>
	<%}%>
</body>
</html>